/**
 * \file test/simple/main.c
 * \author Christian Spoo
 * \date 01.08.2010
 *
 * simple test for the stage API
 */

#include <stdio.h>
#include <unistd.h>

#include <dmxcon/stage.h>
#include <dmxcon/drivers/dmx4all.h>

int main(int argc, char **argv) {
  struct device_t *device;
  struct stage_t *stage;
  unsigned char data[4] = {0, 255, 0, 0};

  device = dmx4all_create("/dev/ttyUSB0");
  if (!device) {
    perror("dmx4all_create");
    return 1;
  }

  stage = stage_create();
  stage_register_device(stage, device, 1000, 1023);

  printf("checking stage_set_channel()...\n");
  stage_set_channel(stage, 1000, 255);
  stage_set_channel(stage, 1001, 0);
  stage_set_channel(stage, 1002, 255);
  
  printf("checking stage_set_channels()...\n");
  stage_set_channels(stage, 1000, data, 4);

  stage_destroy(stage);

  return 0;
}

